#include <iostream>

using namespace std;

/*Write a function to reverse digits of an integer. E.g. 123 --> 321, -890
--> -98.*/

int convert(int input)
{
	bool isNegate = false;
	int reminder;
	int output = 0, multiplier = 10;

	if (input < 0){
		isNegate = true;
		input = -input;
	}

	do {
		reminder = input % 10;
		output = output * 10 + reminder;
		input /= 10;
	} while(input);

	if (isNegate)
		output = -output;

	return output;
}

int reverseDigitsTest()
{
	int test = -980;

	cout <<convert(test) <<endl;

	cin.get();

	return 0;
}